home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr10 / inter35c.zip / INTHELP.ZIP / USERINT2.PAS < prev    next >
Pascal/Delphi Source File  |  1991-10-26  |  2KB  |  83 lines

  1. unit UserInt2;
  2. {The 'plain' userinterface}
  3.  
  4. {if you want to use this one, rename the unit and the file to 'UserInterface'
  5.  and recompile the main program}
  6. interface
  7.   procedure GetFileNames (var InFile, OutFile : String);
  8.   procedure StartPass1;
  9.   procedure StartPass2;
  10.   procedure PutLineNumber (Number : LongInt);
  11.   procedure Finished (LastTopic : Word);
  12.  
  13. implementation
  14. uses DOS, OPDOS, OPSTRING, OPCRT, OPROOT;
  15.  
  16. var
  17.   InputF, OutputF  : String;
  18.   LastLine         : LongInt;
  19.   CursorX, CursorY : Byte;
  20.  
  21.   {------------------------------------------------------------------}
  22.   function GetTheName (Echo : String; MustExist : Boolean):String;
  23.   var
  24.     Result : String;
  25.     Found  : Boolean;
  26.   begin
  27.     Found := False;
  28.     while not Found do begin
  29.       Write (Echo);
  30.       Readln (Result);
  31.       if MustExist then
  32.         Found := ExistFile (Result)
  33.       else
  34.         Found := True;
  35.       if not Found then
  36.         writeln ('File doesn''t seem to exist');
  37.     end{while};
  38.     GetTheName := Result;
  39.   end{GetTheName};
  40.   {------------------------------------------------------------------}
  41.   procedure GetFileNames (var InFile, OutFile : String);
  42.   var
  43.     Parameters : String;
  44.   begin
  45.     InFile  := ParamStr (1);
  46.     OutFile := ParamStr (2);
  47.     if InFile = '' then             {No parameters given when invoking}
  48.       InFile := GetTheName ('Input File : ', True);
  49.     if OutFile = '' then
  50.       OutFile := GetTheName ('Output File : ', False);
  51.   end{GetFileNames};
  52.   {------------------------------------------------------------------}
  53.   procedure PutLineNumber (Number: LongInt);
  54.   begin
  55.     LastLine := Number;
  56.     GotoXYAbs (CursorX, CursorY);
  57.     Write (Number:7);
  58.   end;
  59.   {------------------------------------------------------------------}
  60.   procedure StartPass1;
  61.   begin
  62.     writeln('Pass 1 :');
  63.     WhereXYDirect (CursorX, CursorY);
  64.   end{StartPass1};
  65.   {------------------------------------------------------------------}
  66.   procedure StartPass2;
  67.   begin
  68.     writeln;
  69.     writeln('Pass 2 :');
  70.     WhereXYDirect (CursorX, CursorY);
  71.   end{StartPass2};
  72.   {------------------------------------------------------------------}
  73.   procedure Finished (LastTopic : Word);
  74.   var
  75.     Key : Word;
  76.   begin
  77.     writeln;
  78.     writeln ('Highest Topic number :',LastTopic:1);
  79.     Key := ReadKeyWord;
  80.   end{Finished};
  81.   {------------------------------------------------------------------}
  82. end.
  83.